package com.exercise.module.common.dao.entity;/**
 * Created by kete on 2017-05-11.
 */


import com.exercise.core.exception.EbsException;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * 作者：kete
 * 创建时间：2017-05-11 16:20
 * 功能描述：
 * 版本：
 */
public class EbsFile {


    /** 文件 */
    private File file;

    /** 文件id */
    private String fileId;

    /** 文件路径 */
    private String filePath;

    /** 文件名字 */
    private String fileName;
    /**
     * 文件所属人
     */
    private Integer ownerUserId;

    public Integer getOwnerUserId() {
        return ownerUserId;
    }
    public void setOwnerUserId(Integer ownerUserId) {
        this.ownerUserId = ownerUserId;
    }
    public File getFile() {
        return file;
    }
    public void setFile(File file) {
        this.file = file;
    }
    public String getFileId() {
        return fileId;
    }
    public void setFileId(String fileId) {
        this.fileId = fileId;
    }
    public String getFilePath() {
        return filePath;
    }
    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public InputStream getInputStream() {

        try {
            InputStream input = new FileInputStream(file);
            return input;
        } catch (FileNotFoundException e) {
            throw new EbsException(e);
        }
    }

    public String getFileName() {
        return fileName;
    }
    public void setFileName(String fileName) {
        this.fileName = fileName;
    }
}
